import React, {Component} from 'react';
import './index.less';

import language from '../../language';

import deepCopy from '../../../../public/functions/deep-copy';

class JobHisModal extends Component {
    constructor(props) {
        super(props);
    }

    render() {
        const {modal, table, meta, showHistoryTable} = this.props;
        const {createModal} = modal;
        const {createSimpleTable} = table;
        let template = meta.getMeta();
        
        template['hi_psnjob_history'] && template['hi_psnjob_history'].items.map((item) => {
            if(item.attrcode === "ismainjob") {
                item.visible = true;
            }
        });

        template['hi_psnjob_history_down'] = deepCopy(template['hi_psnjob_history']);



        
        const jobHistory = (that) => {
            return (
                <div>
                    <div 
                        className={showHistoryTable && 'history-box'}
                    >
                        <div className="history-title">{language['hi6007-000192']}</div>
                        {createSimpleTable('hi_psnjob_history', {
                            cancelCustomRightMenu: true
                        })}
                    </div>
                    {
                        showHistoryTable && 
                        <div className="history-box">
                            <div className="history-title">{language['hi6007-000193']}</div>
                            {createSimpleTable('hi_psnjob_history_down', {
                                cancelCustomRightMenu: true
                            })}
                        </div>
                    }
                    
                </div>
            )
        };
        return (
            <div>
                {
                    createModal('jobHistory', {
                        title: language['hi6007-000047'],/* 国际化处理： 任职历史*/
                        content: jobHistory.call(this),
                        size: 'xlg',
                        rightBtnName: null
                    })
                }
            </div>
        );
    }
}

export default JobHisModal;
